<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\LogoAdv;
use services\models\UpFileData;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\LogoAdvSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Logo右侧广告';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="logo-adv-index">
    <p>
        <?= Html::a('创建LOGO广告', ['create'], ['class' => 'btn btn-success']) ?>&nbsp;&nbsp;&nbsp;
        <?= Html::a('刷新缓存', 'javascript:void(0)', ['id'=>'hc']) ?>
    </p>
    
    <div class="box box-success">
        <div class="box-body"><?php echo $this->render('_search', ['model' => $searchModel]); ?></div>
    </div>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'adv_name',
            [
            'label'=>'广告图',
            'value'=> function($data){
                 return  Html::img(UpFileData::showImage($data->pic),['width'=>'150','height'=>'80']) ;
                },
                'format'=>'html'
            ],
            'tag',
            [
            'label'=>'是否显示标签',
            'value'=> function($data){
                 return LogoAdv::$STATUS[$data->tag_display];
                }
            ],
            'url:url',
            [
            'label'=>'推荐时间',
            'value'=> function($data){
                 return $data->recommend_starttime.'～'.$data->recommend_endtime;
                }
            ],
            [
            'label'=>'状态',
            'value'=> function($data){
                 return LogoAdv::$STATUS[$data->status];
                }
            ],
            // 'url:url',
            // 'status',
            // 'recommend_starttime',
            // 'recommend_endtime',
            // 'add_user',
            // 'add_time',

            ['class' => 'yii\grid\ActionColumn','template'=>'{update}'],
        ],
    ]); ?>
</div>
